import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { SArenaCrossPlayerResult } from "../../../../../Message/Public/SArenaCrossPlayerResult";
import { PlayerUtil } from "../../common/util/PlayerUtil";
//class ArenaCrossGroupDetail
    
    export  class ArenaCrossGroupDetail /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.create();
            return;
        }

        /* internal  */create(): void
        {
            ObjCreate.createBg(0, 0, 200, 280, this);
            this._cellList = ObjCreate.createTileList(5, 5, 195, 208, this);
            this._cellList.rowHeight = 52;
            this._cellList.columnWidth = 195;
            this._cellList.setStyle("cellRenderer", PlayerArenaCrossPlayerCell);
            addChild(this._cellList);
            this._btnHide = ObjCreate.createGButton(Language.getString(42257), 76, 245, 50, 22, this);
            this._btnHide.addEventListener(flash.events.MouseEvent.CLICK, this.onClickHide);
            return;
        }

        /* internal  */onClickHide(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.visible = false;
            return;
        }

        public updateData(arg1: Array<any>): void
        {
            this._cellList.dataProvider = new DataProvider(arg1);
            return;
        }

        /* internal */ /* var */_cellList: GTileList;

        /* internal */ /* var */_btnHide: GButton;
    }
}


class PlayerArenaCrossPlayerCell extends CellRenderer
{
    public PlayerArenaCrossPlayerCell()
    {
        super();
        this.create();
        this.initStyles();
        return;
    }

    /* internal  */initStyles(): void
    {
        this.setStyle("downSkin", new Object /* flash.display.Bitmap */());
        this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
        this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
        this.setStyle("selectedDownSkin", new Object /* flash.display.Bitmap */());
        this.setStyle("selectedOverSkin", new Object /* flash.display.Bitmap */());
        this.setStyle("selectedUpSkin", new Object /* flash.display.Bitmap */());
        return;
    }

    /* internal  */create(): void
    {
        this._tfPlayerName = ObjCreate.createTextField("", 0, 0, 150, 20, this);
        this._tfCareer = ObjCreate.createTextField("", 0, 25, 50, 20, this, GlobalStyle.textFormat6);
        this._tfLevel = ObjCreate.createTextField("", 50, 25, 40, 20, this, GlobalStyle.textFormat6);
        this._tfPower = ObjCreate.createTextField("", 90, 25, 100, 20, this, GlobalStyle.textFormat6);
        ObjCreate.createBg(0, 50, 195, 2, this, "SplitLine");
        return;
    }

    public /* override */ set data(arg1: Object)
    {
        if (typeof arg1 === "sarenacrossplayerresult") 
        {
            this.updateInfo(arg1 as SArenaCrossPlayerResult);
        }
        return;
    }

    public /* override */ set label(arg1: string)
    {
        return;
    }

    public updateInfo(arg1: SArenaCrossPlayerResult): void
    {
        this._tfPlayerName.text = arg1.miniPlayer.name;
        this._tfCareer.text = PlayerUtil.getCareerHtml(arg1.miniPlayer.careerEnable);
        this._tfLevel.text = Language.getStringByParam(42258, arg1.miniPlayer.level.toString());
        return;
    }

    /* internal */ /* var */_tfPlayerName: Object /* flash.text.TextField */;

    /* internal */ /* var */_tfCareer: Object /* flash.text.TextField */;

    /* internal */ /* var */_tfLevel: Object /* flash.text.TextField */;

    /* internal */ /* var */_tfPower: Object /* flash.text.TextField */;
